fix(test): [Queue Instrumentation 16] Enable Kafka profile in system runner#5291
Conversation
Make the system test runner configure Kafka requirements by module. Start Kafka and set SPRING_PROFILES_ACTIVE=kafka for modules that need Kafka-backed Spring endpoints so queue system tests run with the expected routing and broker configuration. Co-Authored-By: Claude <noreply@anthropic.com>
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. This PR will not appear in the changelog. 🤖 This preview updates automatically when you update the PR. |
📲 Install BuildsAndroid
|
Require the sentry-kafka producer interceptor class before activating Spring Boot Jakarta queue auto-configuration. This keeps sentry-kafka optional for customers who only use the starter without Kafka queue tracing support on the classpath. Add a regression test that hides sentry-kafka from the classloader and verifies the Kafka bean post-processors are skipped instead of being registered. Co-Authored-By: Claude <noreply@anthropic.com>
Performance metrics 🚀
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit bd9d3b5. Configure here.
| assertThat(context).doesNotHaveBean(SentryKafkaProducerBeanPostProcessor::class.java) | ||
| assertThat(context).doesNotHaveBean(SentryKafkaConsumerBeanPostProcessor::class.java) | ||
| } | ||
| } |
There was a problem hiding this comment.
Test passes for wrong reason, not testing sentry-kafka absence
Medium Severity
The new regression test does not register Kafka BPPs when sentry-kafka is not present uses noSentryKafkaClassLoader which only filters SentryKafkaProducerInterceptor. However, since the OTel class SentryAutoConfigurationCustomizerProvider remains on the test classpath (it's a testImplementation dependency and is not filtered here), the @ConditionalOnMissingClass annotation on SentryKafkaQueueConfiguration already prevents the beans from loading. The test passes because OTel is present, not because sentry-kafka is absent, making it an ineffective regression test. The noSentryKafkaClassLoader needs to also filter the OTel class to isolate the condition being tested.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit bd9d3b5. Configure here.


PR Stack (Queue Instrumentation)
📜 Description
Finalize the top Kafka stack PR with the Spring Boot Jakarta review fix.
Changes:
SPRING_PROFILES_ACTIVE=kafkafor modules that need Kafka endpoints enabledio.sentry.kafka.SentryKafkaProducerInterceptorbefore activating Spring Boot Jakarta Kafka queue auto-configurationsentry-kafkais absent from the classpath💡 Motivation and Context
Kafka queue system tests for
sentry-samples-spring-boot-jakartawere running without thekafkaprofile, so/kafkaendpoints were not active and tests failed with 404s.This PR also fixes the late stack regression where Spring Boot Jakarta queue auto-configuration
could activate without the optional
sentry-kafkamodule being present.💚 How did you test it?
./gradlew spotlessApply apiDump./gradlew :sentry-spring-boot-jakarta:test --tests='*SentryKafkaAutoConfigurationTest'📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
#skip-changelog